/******************** 定义类 ***************************************************************/
/*
    上市企业类
 */
function ListedCompany() {
    this.id = 0;     //唯一ID
    this.number="";//编号
    this.company_id = 0;  //在会员表中的企业ID
    this.company_name = "";   // 企业名称
    this.total_equity = 0;  //总股本
    this.state_owned_shares = 0;   //国有股
    this.legal_person_share = 0;   //法人股
    this.natural_person_shares = 0;  // 自然人股
    this.controlling_shareholder = "";   //控股股东
    this.listed_sector = "";    //上市板块
    this.registered_capital = 0;    //注册资本
    this.create_time = "";   //设立时间
    this.legal_representative = "";//法人代表
    this.contact_person = "";//联系人
    this.mobile_phone = "";//移动电话
    this.office_phone = "";//办公电话
    this.industry_involved = "";//所属行业
    this.main_business = "";//主营业务
    this.enterprise_nature = "";//企业性质
    this.high_tech_enterprise = "否";//是否高新技术企业
    this.poverty_level = "";//是否贫困县
    this.Anti_poverty_leading_enterprise = "否";//是否省级扶贫龙头企业
    this.restructurt_time = "";//改制时间
    this.corporation_set_up_form = "";//股份公司设立形式
    this.counselling_organization = "";//辅导机构
    this.sponsor = "";//保荐机构（人）
    this.law_firm = "";//律师事务所
    this.Account_firm = "";//会计师事务所
    this.schedule = "";//时间安排
    this.registerde_address = "";//注册地址
    this.list_status = "拟上市";
    this.AddOrChange = "";//标记是否已经修改过
    this.status = ""; //审核状态
    this.formated_create_time = new Date();
    this.formated_restructurt_time = new Date();
    this.formated_schedule = new Date();
    this.board = "inside";
}

// 将对象序列化为一个json对象，可以用于http请求或对象复制
ListedCompany.prototype.serialize = function() {
    return Object.assign({}, this, {
        create_time: Date.parse(this.formated_create_time),
        restructurt_time: Date.parse(this.formated_restructurt_time),
        schedule: Date.parse(this.formated_schedule),
    });
}

// 用json数据为对象属性赋值
ListedCompany.prototype.parse = function(data) {
    Object.assign(this, data, {
        content: unescape(data.content),
        formated_create_time: new Date(parseInt(data.create_time)),
        formated_restructurt_time: new Date(parseInt(data.restructurt_time)),
        formated_schedule: new Date(parseInt(data.schedule)),
    });
}

// ******************** 类静态属性与方法 **********************************************
// 解析json数据，返回一个对象
ListedCompany.parse = function(data) {
    var o = new ListedCompany();
    o.parse(data);
    return o;   
}

// 解析json数组，返回对象数组
ListedCompany.parseList = function(list) {
    var len = list.length;
    var arr = new Array(len);
    for(var i = 0; i < len; i++) {
        arr[i] = ListedCompany.parse(list[i]);
    }
    return arr;
}

// ******************** 导出 **********************************************
export default ListedCompany